var popupRestartAfterClose = false;

function closePopup(){
	$('#hideshow').fadeOut('10', function(){
		if(popupRestartAfterClose)
			window.location.reload();
			
		$('#popupContent').html('');
	});
	return false;
}

function closePopupFast(){
	$('#hideshow').hide();
	$('#popupContent').html('');
	return false;
}

function showPopup(content, title, reload){
	scroll(0,0);
	popupRestartAfterClose = reload;
	
	if(title != ''){
		$('#popupTitle').html('<div class="popup_header_blue" style="height:25px;"><div class="popup_title_blue"><div align="center"><strong>'+title+'</strong></div></div><div class="clear"></div></div><!-- popup_header -->');
		$('#popupTitle').show();
	}
	else
		$('#popupTitle').hide();
		
	$('#popupContent').html(content);
	$('#hideshow').show();
	
	var windowWidth = $(window).width();
	var popupBlockWidth = $('#popup_block').width();
	var leftValue = (windowWidth - popupBlockWidth) / 2;
	leftValue += 252;
	//alert(popupBlockWidth);
    $("#popup_block").css('left', leftValue+'px');
}


function closePopup2(){
	$('#hideshow2').fadeOut('10', function(){
		if(popupRestartAfterClose)
			window.location.reload();
			
		$('#popupContent2').html('');
	});
	return false;
}

function closePopupFast2(){
	$('#hideshow2').hide();
	$('#popupContent2').html('');
	return false;
}

function showPopup2(content, title, reload){
	scroll(0,0);
	popupRestartAfterClose = reload;
	if(title != ''){
		$('#popupTitle2').html('<div class="popup_header_orange" style="height:25px;"><div class="popup_title_orange"><div align="center"><strong>'+title+'</strong></div></div><div class="clear"></div></div> <!-- popup_header -->');
		$('#popupTitle2').show();
	}
	else
		$('#popupTitle2').hide();
		
	$('#popupContent2').html(content);
	$('#hideshow2').fadeIn('10');
	//$('#hideshow2').draggable();
	
	var windowWidth = $(window).width();
	var popupBlockWidth = $('#popup_block2').width();
	var leftValue = (windowWidth - popupBlockWidth) / 2;
	leftValue += 352;
	//alert(popupBlockWidth);
    $("#popup_block2").css('left', leftValue+'px');
}


function closePopup3(){
	$('#hideshow3').fadeOut('10', function(){
		if(popupRestartAfterClose)
			window.location.reload();

		$('#popupContent3').html('');
	});
	return false;
}

function closePopupFast3(){
	$('#hideshow3').hide();
	$('#popupContent3').html('');
	return false;
}

function showPopup3(content, title, reload, posx, posy){
	scroll(0,0);
	popupRestartAfterClose = reload;
	if(title != ''){
		$('#popupTitle3').html('<div class="popup_title_gray"><div align="center"><strong>'+title+'</strong></div><div class="clear"></div></div> <!-- popup_header -->');
		$('#popupTitle3').show();
	}
	else
		$('#popupTitle3').hide();

	$('#popupContent3').html(content);
	$('#hideshow3').fadeIn('1');
	//$('#hideshow3').draggable();


	//alert(popupBlockWidth);
    $("#popup_block3").css('left', (posx+50)+'px');
    $("#popup_block3").css('top', (posy+25)+'px');
}